home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c / 376 < prev    next >
Encoding:
Text File  |  1996-08-06  |  2.1 KB  |  49 lines

  1. Newsgroups: comp.std.c
  2. Path: howland.reston.ans.net!torn!sq!msb
  3. From: msb@sq.com (Mark Brader)
  4. Subject: Re: CLOCKS_PER_SEC not defined
  5. Message-ID: <1996Feb19.193805.8602@sq.com>
  6. Organization: SoftQuad Inc., Toronto, Canada
  7. References: <ramin.1174728902A@news.gsfc.nasa.gov> <4g8puk$2ce@usenet.pa.dec.com>
  8. Date: Mon, 19 Feb 1996 19:38:05 GMT
  9.  
  10. > Some non-conforming implementations define __STDC__ with value 0 just
  11. > to be malicious.  Some non-conforming implementations define __STDC__
  12. > with value 1 in order to be fraudulent.
  13.  
  14. Or, in each case, because they thought it was in the programmer's
  15. best interest to do so -- i.e. they thought they knew exactly what a
  16. programmer's reason for checking __STDC__ would be.  Or, in the second
  17. case, because they intended the implementation to be conforming, but
  18. one or more bugs kept it from being so.  Depending on the actual case,
  19. words like "ill-advised" or even "highly stupid and unprofessional"
  20. might be justified, but to go beyond them to "malicious" or "fraudulent"
  21. looks to me like libel.
  22.  
  23. Of course, if one has evidence of malice or fraud, that's different.
  24.  
  25. > The C standard cannot constrain non-conforming implementations but you
  26. > can demand a refund from a fraudulent vendor.
  27.  
  28. You can also contact the police or other applicable authorities.
  29. Fraud is a crime here and anywhere else that I know about.
  30.  
  31. > Try:
  32. >  #include <time.h>
  33. >  #if defined(__STDC__) && __STDC__ == 1 && !defined(CLOCKS_PER_SEC)
  34. >  #error "Get a refund from the fraudulent vendor of this implementation"
  35. >  #endif
  36.  
  37. If we're talking about malice, this isn't sufficient.  If __STDC__ was
  38. defined as 1&&1, it would violate the standard's requirement on a
  39. conforming implementation and thus not claim conformance; but the
  40. above line would not distinguish it from 1, and would act as if
  41. conformance had been indicated.  To avoid this sort of thing, you
  42. have would to stringify __STDC__ and test against "1".
  43.  
  44. -- 
  45. Mark Brader, msb@sq.com | "Anyone who can handle a needle convincingly can make
  46. SoftQuad Inc., Toronto  |  us see a thread which is not there." --E.H. Gombrich
  47.  
  48. My text in this article is in the public domain.
  49.